﻿using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace TMT_CMS.BL.Model.User
{
    public class UserInfoViewModel
    {
        public int ID { get; set; }

        [Required(ErrorMessage = "请输入用户名")]
        [StringLength(50,ErrorMessage = "用户名太长")]
        [Remote("CheckUserNameExists","User",AdditionalFields = "ID",ErrorMessage = "此用户名已经存在")]
        public string UserName { get; set; }

        [Required(ErrorMessage = "请输入密码")]
        [StringLength(50, ErrorMessage = "密码太长")]
        public string Password { get; set; }

        [Required(ErrorMessage = "请再次输入密码")]
        [Compare("Password",ErrorMessage = "两次密码输入不一致")]
        public string ConfirmPassword { get; set; }

        [Required(ErrorMessage = "请输入用户姓名")]
        [StringLength(50, ErrorMessage = "用户姓名太长")]
        public string FamilyName { get; set; }

        [Required(ErrorMessage = "请输入Email")]
        [StringLength(50, ErrorMessage = "Email太长")]
        [RegularExpression(@"^[\w\-\.]+@[\w\-\.]+(\.\w+)+$", ErrorMessage = "格式有误")]
        public string Email { get; set; }

        public int RoleIDs { get; set; }
    }
}
